/* eslint valid-jsdoc: "off" */

'use strict';
const  path =  require('path');
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {
     
  };
  
  config.middleware = [];
  config.keys = '_153455678901594315459121456'
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  config.swaggerdoc = {
    dirScanner: './app/controller', // 配置自动扫描的控制器路径。 
    apiInfo: {
        title: 'NAPI', 
        description: 'swagger-ui for NAPI document.', 
        version: '1.0.0',
    }, 
    consumes: ['application/json'], 
    produces: ['application/json'],  
 };
 config.mysql = {
  client: { 
   
    host: '127.0.0.1', 
    port: '3306', 
    user: 'root', 
    //password: '',  
    database: 'wzskyline',
    timezone:  '+08:00',
    dateStrings: 'DATETIME', // 返回形式
    debug: false, // 可以看sql日志
  },
};
config.static = {
  prefix:"/",
  dir:path.join(appInfo.baseDir,'app/public'),
  dynamic:true,
  preload:false,
  buffer:false,
};

config.cluster = {
  listen: {
    port: 7001,//端口
    hostname: '127.0.0.1', //你的IP
  },
};

config.jwt = {
  secret: "123456",//自定义 token 的加密条件字符串
  timeout: 1000 * 60 * 60  * 12  ,
};
config.security = {
  csrf: {
    enable: false,
    ignoreJSON: true
  },
  domainWhiteList: ['http://localhost:8080'],//允许访问接口的白名单
};
config.cors = {
  origin:'*',
  allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
}; // https://blog.csdn.net/weixin_43704471/article/details/91633142


  return {
    ...config,
    ...userConfig,
  };
};
